namespace QMVnSoft.Lists
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormDmSpEditor : FormListEditor
    {
        private IContainer components;
        private LabelControl lblDvt;
        private LabelControl lblDvt_E;
        private LabelControl lblKhau_Hao;
        private LabelControl lblKhau_Hao0;
        private LabelControl lblLoai_Sp;
        private LabelControl lblLoai_Sp0;
        private LabelControl lblMa_Sp;
        private LabelControl lblMa_Sp_Me;
        private LabelControl lblSP_CT;
        private LabelControl lblSP_CT0;
        private LabelControl lblTen_Sp;
        private LabelControl lblTen_Sp_E;
        private LabelControl lblTien622;
        private TextControl txtDvt;
        private TextControl txtDvt_E;
        private TextOption txtKhau_Hao;
        private TextOption txtLoai_Sp;
        private TextControl txtMa_Sp;
        private TextSearch txtMa_Sp_Me;
        private TextOption txtSP_CT;
        private TextControl txtTen_Sp;
        private TextControl txtTen_Sp_E;
        private TextControl txtTen_Sp_Me;
        private TextNumeric txtTien622;

        public FormDmSpEditor()
        {
            this.InitializeComponent();
            this.txtDvt.GotFocus += new EventHandler(this.txtDvt_GotFocus);
            this.txtDvt_E.GotFocus += new EventHandler(this.txtDvt_GotFocus);
            this.txtKhau_Hao.GotFocus += new EventHandler(this.txtDvt_GotFocus);
            this.txtTien622.GotFocus += new EventHandler(this.txtDvt_GotFocus);
            this.txtMa_Sp_Me.GotFocus += new EventHandler(this.txtDvt_GotFocus);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormDmSpEditor));
            this.txtMa_Sp = new TextControl();
            this.lblMa_Sp = new LabelControl();
            this.txtTen_Sp = new TextControl();
            this.lblTen_Sp = new LabelControl();
            this.txtTen_Sp_E = new TextControl();
            this.lblTen_Sp_E = new LabelControl();
            this.lblLoai_Sp = new LabelControl();
            this.txtLoai_Sp = new TextOption();
            this.txtMa_Sp_Me = new TextSearch();
            this.txtTen_Sp_Me = new TextControl();
            this.lblMa_Sp_Me = new LabelControl();
            this.lblLoai_Sp0 = new LabelControl();
            this.lblDvt_E = new LabelControl();
            this.lblDvt = new LabelControl();
            this.txtDvt_E = new TextControl();
            this.txtDvt = new TextControl();
            this.lblKhau_Hao0 = new LabelControl();
            this.txtKhau_Hao = new TextOption();
            this.lblKhau_Hao = new LabelControl();
            this.txtTien622 = new TextNumeric();
            this.lblTien622 = new LabelControl();
            this.lblSP_CT = new LabelControl();
            this.txtSP_CT = new TextOption();
            this.lblSP_CT0 = new LabelControl();
            base.SuspendLayout();
            base.txtMa_Loai3.FirstFilter = "Type = 'SP3'";
            base.txtMa_Loai3.Location = new Point(0x1aa, 0xf8);
            base.txtMa_Loai3.Size = new Size(0x95, 20);
            base.txtMa_Loai3.TabIndex = 12;
            base.txtMa_Loai2.FirstFilter = "Type = 'SP2'";
            base.txtMa_Loai2.Location = new Point(0x112, 0xf8);
            base.txtMa_Loai2.Size = new Size(150, 20);
            base.txtMa_Loai2.TabIndex = 11;
            base.txtMa_Loai1.FirstFilter = "Type = 'SP1'";
            base.txtMa_Loai1.Location = new Point(0x7b, 0xf8);
            base.txtMa_Loai1.Size = new Size(0x95, 20);
            base.txtMa_Loai1.TabIndex = 10;
            base.lblPhan_Loai.Location = new Point(12, 0xfb);
            this.txtMa_Sp.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Sp.DisabledForeColor = Color.Empty;
            this.txtMa_Sp.Font = new Font("Arial", 8.25f);
            this.txtMa_Sp.Location = new Point(0x7b, 0x48);
            this.txtMa_Sp.MaxLength = 0x20;
            this.txtMa_Sp.Name = "txtMa_Sp";
            this.txtMa_Sp.OldValue = null;
            this.txtMa_Sp.Size = new Size(0x95, 20);
            this.txtMa_Sp.TabIndex = 2;
            this.txtMa_Sp.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Sp.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Sp.Value = null;//manager.GetObject("txtMa_Sp.Value");
            this.lblMa_Sp.AutoSize = true;
            this.lblMa_Sp.Font = new Font("Arial", 8.25f);
            this.lblMa_Sp.Location = new Point(12, 0x4b);
            this.lblMa_Sp.Name = "lblMa_Sp";
            this.lblMa_Sp.Size = new Size(0x15, 14);
            this.lblMa_Sp.TabIndex = 4;
            this.lblMa_Sp.Text = "Mã";
            this.txtTen_Sp.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Sp.DisabledForeColor = Color.Empty;
            this.txtTen_Sp.Font = new Font("Arial", 8.25f);
            this.txtTen_Sp.Location = new Point(0x7b, 0x5e);
            this.txtTen_Sp.MaxLength = 128;
            this.txtTen_Sp.Name = "txtTen_Sp";
            this.txtTen_Sp.OldValue = null;
            this.txtTen_Sp.Size = new Size(0x1c4, 20);
            this.txtTen_Sp.TabIndex = 3;
            this.txtTen_Sp.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtTen_Sp.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTen_Sp.Value = null;//manager.GetObject("txtTen_Sp.Value");
            this.lblTen_Sp.AutoSize = true;
            this.lblTen_Sp.Font = new Font("Arial", 8.25f);
            this.lblTen_Sp.Location = new Point(12, 0x61);
            this.lblTen_Sp.Name = "lblTen_Sp";
            this.lblTen_Sp.Size = new Size(0x19, 14);
            this.lblTen_Sp.TabIndex = 4;
            this.lblTen_Sp.Text = "Tên";
            this.txtTen_Sp_E.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Sp_E.DisabledForeColor = Color.Empty;
            this.txtTen_Sp_E.Font = new Font("Arial", 8.25f);
            this.txtTen_Sp_E.Location = new Point(0x7b, 0x74);
            this.txtTen_Sp_E.MaxLength = 128;
            this.txtTen_Sp_E.Name = "txtTen_Sp_E";
            this.txtTen_Sp_E.OldValue = null;
            this.txtTen_Sp_E.Size = new Size(0x1c4, 20);
            this.txtTen_Sp_E.TabIndex = 4;
            this.txtTen_Sp_E.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtTen_Sp_E.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTen_Sp_E.Value = null;//manager.GetObject("txtTen_Sp_E.Value");
            this.lblTen_Sp_E.AutoSize = true;
            this.lblTen_Sp_E.Font = new Font("Arial", 8.25f);
            this.lblTen_Sp_E.Location = new Point(12, 0x77);
            this.lblTen_Sp_E.Name = "lblTen_Sp_E";
            this.lblTen_Sp_E.Size = new Size(0x4a, 14);
            this.lblTen_Sp_E.TabIndex = 4;
            this.lblTen_Sp_E.Text = "Tên tiếng Anh";
            this.lblLoai_Sp.AutoSize = true;
            this.lblLoai_Sp.Font = new Font("Arial", 8.25f);
            this.lblLoai_Sp.Location = new Point(12, 0x35);
            this.lblLoai_Sp.Name = "lblLoai_Sp";
            this.lblLoai_Sp.Size = new Size(0x1b, 14);
            this.lblLoai_Sp.TabIndex = 4;
            this.lblLoai_Sp.Text = "Loại";
            this.txtLoai_Sp.CharacterCasing = CharacterCasing.Upper;
            this.txtLoai_Sp.DisabledForeColor = Color.Empty;
            this.txtLoai_Sp.Font = new Font("Arial", 8.25f);
            this.txtLoai_Sp.InputMask = "C,K";
            this.txtLoai_Sp.Location = new Point(0x7b, 50);
            this.txtLoai_Sp.Name = "txtLoai_Sp";
            this.txtLoai_Sp.OldValue = null;
            this.txtLoai_Sp.Size = new Size(0x17, 20);
            this.txtLoai_Sp.TabIndex = 1;
            this.txtLoai_Sp.Text = "C";
            this.txtLoai_Sp.Value = "C";
            this.txtMa_Sp_Me.CharacterCasing = CharacterCasing.Upper;
            this.txtMa_Sp_Me.DisabledForeColor = Color.Empty;
            this.txtMa_Sp_Me.EmptyIsValid = true;
            this.txtMa_Sp_Me.FieldDisplay = "Ten_Sp";
            this.txtMa_Sp_Me.Font = new Font("Arial", 8.25f);
            this.txtMa_Sp_Me.FoundIsValid = true;
            this.txtMa_Sp_Me.Location = new Point(0x7b, 0xcc);
            this.txtMa_Sp_Me.MaxLength = 0x20;
            this.txtMa_Sp_Me.Name = "txtMa_Sp_Me";
            this.txtMa_Sp_Me.OldValue = null;
            this.txtMa_Sp_Me.Size = new Size(0x95, 20);
            this.txtMa_Sp_Me.TabIndex = 8;
            this.txtMa_Sp_Me.TableName = "DMSP";
            this.txtMa_Sp_Me.TextDisplay = this.txtTen_Sp_Me;
            this.txtMa_Sp_Me.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtMa_Sp_Me.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtMa_Sp_Me.Value = null;//manager.GetObject("txtMa_Sp_Me.Value");
            this.txtTen_Sp_Me.BackColor = SystemColors.Control;
            this.txtTen_Sp_Me.BorderStyle = BorderStyle.None;
            this.txtTen_Sp_Me.DisabledForeColor = Color.Blue;
            this.txtTen_Sp_Me.Enabled = false;
            this.txtTen_Sp_Me.Font = new Font("Arial", 8.25f);
            this.txtTen_Sp_Me.ForeColor = Color.Blue;
            this.txtTen_Sp_Me.Location = new Point(0x116, 0xcf);
            this.txtTen_Sp_Me.Name = "txtTen_Sp_Me";
            this.txtTen_Sp_Me.OldValue = null;
            this.txtTen_Sp_Me.Size = new Size(0x129, 13);
            this.txtTen_Sp_Me.TabIndex = 13;
//            this.txtTen_Sp_Me.Value = null;//manager.GetObject("txtTen_Sp_Me.Value");
            this.lblMa_Sp_Me.AutoSize = true;
            this.lblMa_Sp_Me.Font = new Font("Arial", 8.25f);
            this.lblMa_Sp_Me.Location = new Point(12, 0xcf);
            this.lblMa_Sp_Me.Name = "lblMa_Sp_Me";
            this.lblMa_Sp_Me.Size = new Size(0x6f, 14);
            this.lblMa_Sp_Me.TabIndex = 4;
            this.lblMa_Sp_Me.Text = "Công đoạn/Công trình";
            this.lblLoai_Sp0.AutoSize = true;
            this.lblLoai_Sp0.Font = new Font("Arial", 8.25f);
            this.lblLoai_Sp0.ForeColor = Color.Blue;
            this.lblLoai_Sp0.Location = new Point(0x98, 0x35);
            this.lblLoai_Sp0.Name = "lblLoai_Sp0";
            this.lblLoai_Sp0.Size = new Size(0xee, 14);
            this.lblLoai_Sp0.TabIndex = 0x21;
            this.lblLoai_Sp0.Text = "K-Công đoạn/Công trình, C-Sản phẩm/Hạng mục";
            this.lblDvt_E.AutoSize = true;
            this.lblDvt_E.Font = new Font("Arial", 8.25f);
            this.lblDvt_E.Location = new Point(12, 0xa3);
            this.lblDvt_E.Name = "lblDvt_E";
            this.lblDvt_E.Size = new Size(0x6c, 14);
            this.lblDvt_E.TabIndex = 0x26;
            this.lblDvt_E.Text = "Đơn vị tính tiếng Anh";
            this.lblDvt.AutoSize = true;
            this.lblDvt.Font = new Font("Arial", 8.25f);
            this.lblDvt.Location = new Point(12, 0x8d);
            this.lblDvt.Name = "lblDvt";
            this.lblDvt.Size = new Size(0x3b, 14);
            this.lblDvt.TabIndex = 0x25;
            this.lblDvt.Text = "Đơn vị tính";
            this.txtDvt_E.DisabledForeColor = Color.Empty;
            this.txtDvt_E.Font = new Font("Arial", 8.25f);
            this.txtDvt_E.Location = new Point(0x7b, 160);
            this.txtDvt_E.MaxLength = 20;
            this.txtDvt_E.Name = "txtDvt_E";
            this.txtDvt_E.OldValue = null;
            this.txtDvt_E.Size = new Size(0x95, 20);
            this.txtDvt_E.TabIndex = 6;
            this.txtDvt_E.UserTextLength = AppInstance.TextControlLength.ItemUnit;
            this.txtDvt_E.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtDvt_E.Value = null;//manager.GetObject("txtDvt_E.Value");
            this.txtDvt.DisabledForeColor = Color.Empty;
            this.txtDvt.Font = new Font("Arial", 8.25f);
            this.txtDvt.Location = new Point(0x7b, 0x8a);
            this.txtDvt.MaxLength = 20;
            this.txtDvt.Name = "txtDvt";
            this.txtDvt.OldValue = null;
            this.txtDvt.Size = new Size(0x95, 20);
            this.txtDvt.TabIndex = 5;
            this.txtDvt.UserTextLength = AppInstance.TextControlLength.ItemUnit;
            this.txtDvt.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtDvt.Value = null;//manager.GetObject("txtDvt.Value");
            this.lblKhau_Hao0.AutoSize = true;
            this.lblKhau_Hao0.Font = new Font("Arial", 8.25f);
            this.lblKhau_Hao0.ForeColor = Color.Blue;
            this.lblKhau_Hao0.Location = new Point(0x98, 0xb9);
            this.lblKhau_Hao0.Name = "lblKhau_Hao0";
            this.lblKhau_Hao0.Size = new Size(0xd1, 14);
            this.lblKhau_Hao0.TabIndex = 0x2a;
            this.lblKhau_Hao0.Text = "C-C\x00f3 phân bổ tỷ lệ, K-Không phân bổ tỷ lệ";
            this.txtKhau_Hao.CharacterCasing = CharacterCasing.Upper;
            this.txtKhau_Hao.DisabledForeColor = Color.Empty;
            this.txtKhau_Hao.Font = new Font("Arial", 8.25f);
            this.txtKhau_Hao.InputMask = "C,K";
            this.txtKhau_Hao.Location = new Point(0x7b, 0xb6);
            this.txtKhau_Hao.Name = "txtKhau_Hao";
            this.txtKhau_Hao.OldValue = null;
            this.txtKhau_Hao.Size = new Size(0x17, 20);
            this.txtKhau_Hao.TabIndex = 7;
            this.txtKhau_Hao.Text = "C";
            this.txtKhau_Hao.Value = "C";
            this.lblKhau_Hao.AutoSize = true;
            this.lblKhau_Hao.Font = new Font("Arial", 8.25f);
            this.lblKhau_Hao.Location = new Point(12, 0xb9);
            this.lblKhau_Hao.Name = "lblKhau_Hao";
            this.lblKhau_Hao.Size = new Size(0x3e, 14);
            this.lblKhau_Hao.TabIndex = 40;
            this.lblKhau_Hao.Text = "Chi phí tỷ lệ";
            this.txtTien622.DisabledForeColor = Color.Blue;
            this.txtTien622.Font = new Font("Arial", 8.25f);
            this.txtTien622.Location = new Point(0x7b, 0xe2);
            this.txtTien622.Name = "txtTien622";
            this.txtTien622.OldValue = null;
            this.txtTien622.Size = new Size(0x95, 20);
            this.txtTien622.TabIndex = 9;
            this.txtTien622.TextAlign = HorizontalAlignment.Right;
            this.txtTien622.UserTextNumericFormat = AppInstance.TextNumericFormat.LocalAmount;
//            this.txtTien622.Value = null;//manager.GetObject("txtTien622.Value");
            this.lblTien622.AutoSize = true;
            this.lblTien622.Font = new Font("Arial", 8.25f);
            this.lblTien622.Location = new Point(12, 0xe5);
            this.lblTien622.Name = "lblTien622";
            this.lblTien622.Size = new Size(0x59, 14);
            this.lblTien622.TabIndex = 0x2b;
            this.lblTien622.Text = "Lương sản phẩm";
            this.lblSP_CT.AutoSize = true;
            this.lblSP_CT.Font = new Font("Arial", 8.25f);
            this.lblSP_CT.Location = new Point(12, 0x1f);
            this.lblSP_CT.Name = "lblSP_CT";
            this.lblSP_CT.Size = new Size(0x71, 14);
            this.lblSP_CT.TabIndex = 4;
            this.lblSP_CT.Text = "Sản phẩm / Công trình";
            this.txtSP_CT.CharacterCasing = CharacterCasing.Upper;
            this.txtSP_CT.DisabledForeColor = Color.Empty;
            this.txtSP_CT.Font = new Font("Arial", 8.25f);
            this.txtSP_CT.InputMask = "S,C";
            this.txtSP_CT.Location = new Point(0x7b, 0x1c);
            this.txtSP_CT.Name = "txtSP_CT";
            this.txtSP_CT.OldValue = null;
            this.txtSP_CT.Size = new Size(0x17, 20);
            this.txtSP_CT.TabIndex = 0;
            this.txtSP_CT.Text = "S";
            this.txtSP_CT.Value = "S";
            this.lblSP_CT0.AutoSize = true;
            this.lblSP_CT0.Font = new Font("Arial", 8.25f);
            this.lblSP_CT0.ForeColor = Color.Blue;
            this.lblSP_CT0.Location = new Point(0x98, 0x1f);
            this.lblSP_CT0.Name = "lblSP_CT0";
            this.lblSP_CT0.Size = new Size(0x84, 14);
            this.lblSP_CT0.TabIndex = 0x21;
            this.lblSP_CT0.Text = "S-Sản phẩm, C-Công trình";
            base.AddTitleText = "Thêm mới sản phẩm, công trình";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.ClientSize = new Size(0x250, 0x11a);
            base.Controls.Add(this.txtTien622);
            base.Controls.Add(this.lblTien622);
            base.Controls.Add(this.lblKhau_Hao0);
            base.Controls.Add(this.txtKhau_Hao);
            base.Controls.Add(this.lblKhau_Hao);
            base.Controls.Add(this.lblDvt_E);
            base.Controls.Add(this.lblDvt);
            base.Controls.Add(this.txtDvt_E);
            base.Controls.Add(this.txtDvt);
            base.Controls.Add(this.lblSP_CT0);
            base.Controls.Add(this.lblLoai_Sp0);
            base.Controls.Add(this.txtTen_Sp_Me);
            base.Controls.Add(this.txtMa_Sp_Me);
            base.Controls.Add(this.txtSP_CT);
            base.Controls.Add(this.txtLoai_Sp);
            base.Controls.Add(this.lblSP_CT);
            base.Controls.Add(this.lblTen_Sp_E);
            base.Controls.Add(this.lblLoai_Sp);
            base.Controls.Add(this.lblTen_Sp);
            base.Controls.Add(this.lblMa_Sp_Me);
            base.Controls.Add(this.lblMa_Sp);
            base.Controls.Add(this.txtTen_Sp_E);
            base.Controls.Add(this.txtTen_Sp);
            base.Controls.Add(this.txtMa_Sp);
            base.EditTitleText = "Sửa sản phẩm, công trình";
            base.FirstFreeCode = "SP1";
            base.Name = "FormDmSpEditor";
            base.SecondFreeCode = "SP2";
            this.Text = "Them moi nhom vat tu, hang hoa";
            base.ThirdFreeCode = "SP3";
            base.Controls.SetChildIndex(base.lblPhan_Loai, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai1, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai2, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai3, 0);
            base.Controls.SetChildIndex(this.txtMa_Sp, 0);
            base.Controls.SetChildIndex(this.txtTen_Sp, 0);
            base.Controls.SetChildIndex(this.txtTen_Sp_E, 0);
            base.Controls.SetChildIndex(this.lblMa_Sp, 0);
            base.Controls.SetChildIndex(this.lblMa_Sp_Me, 0);
            base.Controls.SetChildIndex(this.lblTen_Sp, 0);
            base.Controls.SetChildIndex(this.lblLoai_Sp, 0);
            base.Controls.SetChildIndex(this.lblTen_Sp_E, 0);
            base.Controls.SetChildIndex(this.lblSP_CT, 0);
            base.Controls.SetChildIndex(this.txtLoai_Sp, 0);
            base.Controls.SetChildIndex(this.txtSP_CT, 0);
            base.Controls.SetChildIndex(this.txtMa_Sp_Me, 0);
            base.Controls.SetChildIndex(this.txtTen_Sp_Me, 0);
            base.Controls.SetChildIndex(this.lblLoai_Sp0, 0);
            base.Controls.SetChildIndex(this.lblSP_CT0, 0);
            base.Controls.SetChildIndex(this.txtDvt, 0);
            base.Controls.SetChildIndex(this.txtDvt_E, 0);
            base.Controls.SetChildIndex(this.lblDvt, 0);
            base.Controls.SetChildIndex(this.lblDvt_E, 0);
            base.Controls.SetChildIndex(this.lblKhau_Hao, 0);
            base.Controls.SetChildIndex(this.txtKhau_Hao, 0);
            base.Controls.SetChildIndex(this.lblKhau_Hao0, 0);
            base.Controls.SetChildIndex(this.lblTien622, 0);
            base.Controls.SetChildIndex(this.txtTien622, 0);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        public override bool OnSave()
        {
            DataRow localCurrentRow;
            if (string.IsNullOrEmpty(this.txtMa_Sp.Text))
            {
                MessageBox.Show("Chưa nhập mã sản phẩm!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtTen_Sp.Text))
            {
                MessageBox.Show("Chưa nhập tên sản phẩm!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.NewChecked)
            {
                localCurrentRow = base.LocalTable.NewRow();
            }
            else
            {
                localCurrentRow = base.LocalCurrentRow;
            }
            localCurrentRow["SP_CT"] = this.txtSP_CT.Value;
            localCurrentRow["Loai_Sp"] = this.txtLoai_Sp.Value;
            localCurrentRow["Ma_SP"] = this.txtMa_Sp.Value;
            localCurrentRow["Ten_Sp"] = this.txtTen_Sp.Value;
            localCurrentRow["Ten_Sp_E"] = this.txtTen_Sp_E.Value;
            localCurrentRow["Dvt"] = this.txtDvt.Value;
            localCurrentRow["Dvt_E"] = this.txtDvt_E.Value;
            localCurrentRow["Khau_Hao"] = this.txtKhau_Hao.Value;
            localCurrentRow["Ma_Sp_Me"] = this.txtMa_Sp_Me.Value;
            localCurrentRow["Ten_Sp_Me"] = this.txtTen_Sp_Me.Value;
            localCurrentRow["Tien622"] = this.txtTien622.Value;
            localCurrentRow["Ma_Loai1"] = base.txtMa_Loai1.Value;
            localCurrentRow["Ma_Loai2"] = base.txtMa_Loai2.Value;
            localCurrentRow["Ma_Loai3"] = base.txtMa_Loai3.Value;
            DmSpDataAccess access = new DmSpDataAccess();
            if (base.ShowMessage(localCurrentRow, access.SaveRow(base.NewChecked, localCurrentRow)))
            {
                return false;
            }
            if (base.NewChecked)
            {
                base.LocalTable.Rows.Add(localCurrentRow);
            }
            base.LocalCurrentRow = localCurrentRow;
            base.LocalTable.AcceptChanges();
            this.txtMa_Sp.Focus();
            return base.OnSave();
        }

        public override void OnShow()
        {
            this.txtSP_CT.Value = base.LocalCurrentRow["SP_CT"];
            this.txtLoai_Sp.Value = base.LocalCurrentRow["Loai_Sp"];
            this.txtMa_Sp.Value = base.LocalCurrentRow["Ma_SP"];
            this.txtTen_Sp.Value = base.LocalCurrentRow["Ten_Sp"];
            this.txtTen_Sp_E.Value = base.LocalCurrentRow["Ten_Sp_E"];
            this.txtDvt.Value = base.LocalCurrentRow["Dvt"];
            this.txtDvt_E.Value = base.LocalCurrentRow["Dvt_E"];
            this.txtKhau_Hao.Value = base.LocalCurrentRow["Khau_Hao"];
            this.txtMa_Sp_Me.Value = base.LocalCurrentRow["Ma_Sp_Me"];
            this.txtTen_Sp_Me.Value = base.LocalCurrentRow["Ten_Sp_Me"];
            this.txtTien622.Value = base.LocalCurrentRow["Tien622"];
            base.txtMa_Loai1.Value = base.LocalCurrentRow["Ma_Loai1"];
            base.txtMa_Loai2.Value = base.LocalCurrentRow["Ma_Loai2"];
            base.txtMa_Loai3.Value = base.LocalCurrentRow["Ma_Loai3"];
            base.OnShow();
        }

        private void txtDvt_GotFocus(object sender, EventArgs e)
        {
            if (this.txtSP_CT.Text.Equals("S") && this.txtLoai_Sp.Text.Equals("C"))
            {
                this.txtDvt.ReadOnly = false;
                this.txtDvt_E.ReadOnly = false;
                this.txtKhau_Hao.ReadOnly = false;
                this.txtTien622.ReadOnly = false;
            }
            else
            {
                this.txtDvt.Text = string.Empty;
                this.txtDvt_E.Text = string.Empty;
                this.txtKhau_Hao.Text = "C";
                this.txtTien622.Value = 0;
                this.txtDvt.ReadOnly = true;
                this.txtDvt_E.ReadOnly = true;
                this.txtKhau_Hao.ReadOnly = true;
                this.txtTien622.ReadOnly = true;
            }
            this.txtMa_Sp_Me.Text = this.txtLoai_Sp.Text.Equals("K") ? "" : this.txtMa_Sp_Me.Text;
            this.txtMa_Sp_Me.ReadOnly = this.txtLoai_Sp.Text.Equals("K");
            this.txtMa_Sp_Me.FirstFilter = "Loai_SP = 'K' AND SP_CT = '" + this.txtSP_CT.Text.Trim() + "'";
        }
    }
}

